home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #9 / Amiga Plus CD - 2004 - No. 09.iso / amigaplus / tools / dev_libs / feelin040718 / demos / fonts.c < prev    next >
C/C++ Source or Header  |  2004-08-03  |  4KB  |  119 lines

  1. /*
  2.  
  3.    This example shows how fonts are dynamic font handled
  4.  
  5. */
  6.  
  7. #include <libraries/feelin.h>
  8.  
  9. #include <proto/exec.h>
  10. #include <proto/dos.h>
  11. #include <proto/feelin.h>
  12.  
  13. struct FeelinBase                  *FeelinBase;
  14.  
  15. ///new_title
  16. FObject new_title(STRPTR Title)
  17. {
  18.    return   TextObject,
  19.             FA_Frame,         "0:03.06020602",
  20.             FA_Back,          FI_HalfShadow,
  21.             FA_ChainToCycle,  FALSE,
  22.             FA_Text,          Title,
  23.             FA_Text_PreParse, "<align=center><pens style=emboss>",
  24.             FA_Text_VCenter,  TRUE,
  25.             FA_Weight,        5,
  26.             End;
  27. }
  28. //+
  29. ///new_string
  30. FObject new_string(void)
  31. {
  32.    return   StringObject,
  33.             FA_SetMax,              FALSE,
  34.            "FA_String_AdvanceOnCR", FALSE,
  35.            "FA_String_MaxLen",      32,
  36.             End;
  37. }
  38. //+
  39. ///new_image
  40. FObject new_image(void)
  41. {
  42.    return   ImageObject,
  43.             FA_ChainToCycle,  FALSE,
  44.             FA_SetMax,        TRUE,
  45.            "FA_Image_Spec",   "B:Loupe",
  46.             End;
  47. }
  48. //+
  49.  
  50. void main(void)
  51. {
  52.    FObject app,win,str_1,str_2,str_3;
  53.  
  54.    if (FeelinBase = (struct FeelinBase *) OpenLibrary("feelin.library",FV_VERSION))
  55.    {
  56.       app = AppObject,
  57.          FA_ColorScheme, "c:64DC82,c:55AF64,c:0A460A,c:FF0000,c:FFFFFF",
  58.  
  59.          Child, win = WindowObject,
  60.             FA_Back,         "P:Feelin:Images/StripGreen.png",
  61.             FA_Window_Title, "Feelin : Fonts",
  62.             FA_Window_Open,   TRUE,
  63.  
  64.             Child, VGroup,
  65.                Child, TextObject,
  66.                   FA_ChainToCycle,  FALSE,
  67.                   FA_Text,          "<align=center><pens text=halfdark shadow=halfshadow>Changing fonts will<br>dynamically update layout.<br>Try <b><font face=topaz size=8>topaz/8</font></b> to see...",
  68.                   FA_SetMax,        FV_SetMaxH,
  69.                   End,
  70.  
  71.                Child, VGroup, FA_Group_Rows, 3,
  72.                   Child, new_title("Icons"),
  73.                   Child, str_1 = new_string(),
  74.                   Child, new_image(),
  75.  
  76.                   Child, new_title("Default"),
  77.                   Child, str_2 = new_string(),
  78.                   Child, new_image(),
  79.  
  80.                   Child, new_title("Screen"),
  81.                   Child, str_3 = new_string(),
  82.                   Child, new_image(),
  83.                End,
  84.  
  85.                Child, Bar,
  86.  
  87.                Child, HGroup, FA_Group_SameSize,TRUE,
  88.                   Child, SimpleButton("<b>Save</b>"),
  89.                   Child, SimpleButton("<pens text=halfdark>Use</pens>"),
  90.                   Child, SimpleButton("<pens text=highligth>Cancel</pens>"),
  91.                End,
  92.             End,
  93.          End,
  94.       End;
  95.  
  96.       if (app)
  97.       {
  98.          F_Do(str_1,FM_Notify,"FA_String_Changed",FV_Notify_Always,FV_Notify_Self,FM_Set,2,FA_Font,FV_Notify_Value);
  99.          F_Do(str_2,FM_Notify,"FA_String_Changed",FV_Notify_Always,FV_Notify_Self,FM_Set,2,FA_Font,FV_Notify_Value);
  100.          F_Do(str_3,FM_Notify,"FA_String_Changed",FV_Notify_Always,FV_Notify_Self,FM_Set,2,FA_Font,FV_Notify_Value);
  101.  
  102.          F_Set(str_1,(ULONG) "FA_String_Contents",(ULONG) "Helvetica/9");
  103.          F_Set(str_2,(ULONG) "FA_String_Contents",(ULONG) "Helvetica/11");
  104.          F_Set(str_3,(ULONG) "FA_String_Contents",(ULONG) "Helvetica/13");
  105.  
  106.          F_Do(win,FM_Notify,FA_Window_CloseRequest,TRUE,app,FM_Application_Shutdown,0);
  107.          F_Do(app,FM_Application_Run);
  108.          F_DisposeObj(app);
  109.        }
  110.  
  111.       CloseLibrary(FeelinBase);
  112.    }
  113.    else
  114.    {
  115.       Printf("Unable to open feelin.library v%ld\n",FV_VERSION);
  116.    }
  117. }
  118.  
  119.